namespace Persistent.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Games",
                c => new
                    {
                        GameId = c.Int(nullable: false, identity: true),
                        GameDateAndTime = c.DateTime(nullable: false),
                        GameStatus = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.GameId);
            
            CreateTable(
                "dbo.GamePlayers",
                c => new
                    {
                        GamePlayerId = c.Int(nullable: false, identity: true),
                        PlayingStatus = c.Int(nullable: false),
                        Player_PlayerId = c.Int(),
                        Game_GameId = c.Int(),
                    })
                .PrimaryKey(t => t.GamePlayerId)
                .ForeignKey("dbo.Players", t => t.Player_PlayerId)
                .ForeignKey("dbo.Games", t => t.Game_GameId)
                .Index(t => t.Player_PlayerId)
                .Index(t => t.Game_GameId);
            
            CreateTable(
                "dbo.Players",
                c => new
                    {
                        PlayerId = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false),
                        Age = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.PlayerId);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.GamePlayers", new[] { "Game_GameId" });
            DropIndex("dbo.GamePlayers", new[] { "Player_PlayerId" });
            DropForeignKey("dbo.GamePlayers", "Game_GameId", "dbo.Games");
            DropForeignKey("dbo.GamePlayers", "Player_PlayerId", "dbo.Players");
            DropTable("dbo.Players");
            DropTable("dbo.GamePlayers");
            DropTable("dbo.Games");
        }
    }
}
